package me.youline.dataServer.service;

import java.io.IOException;
import java.util.List;

import me.youline.dataServer.dao.ArSceneEntityDAO;
import me.youline.dataServer.entity.ArSceneEntity;
import me.youline.dataServer.exception.ImageScaleException;
import me.youline.dataServer.service.image.ImageScaleService;
import me.youline.dataServer.service.support.file.FileBuilder.FileEntity;

import org.springframework.beans.factory.annotation.Autowired;

public class ArSceneService {
	@Autowired
	private ArSceneEntityDAO arSceneEntityDAO;
	
	@Autowired
	private ImageScaleService imageScaleService;
	
	
	public ArSceneEntity addArSceneEntity(ArSceneEntity e) throws IOException{
		e = arSceneEntityDAO.save(e);
		return e;
	}
	
	
	public List<ArSceneEntity> getArSceneEntitiesList(){
		return arSceneEntityDAO.findAll();
	}
	
	public  void saveSceneFile(FileEntity sceneFile,List<FileEntity> designPics,FileEntity scenePic) throws ImageScaleException, IOException{
		sceneFile.save();
		for(FileEntity e : designPics){
			e.save();
		}
		scenePic.save();
		//imageScaleService.scaleImage(new DefaultImageScaleContext(sceneFile.getFile(),));
	}
}
